My project runs well in Firefox and <=Chrome 94. When the Chrome updates to 95, it giving an Error
Uncaught SyntaxError: Invalid regular expression: /:\d+$/: Regular expression too large.
This is the related code
export const baseURL = (window.location.origin || 'https://www.xxxxx.com')
.replace(/:\d+$/, '')
.replace(/\/\/(\S+?)\./, (_a, _p1) => `//${window.station === 'cn' ? 'aaaa' : 'bbbb'}.`);
It will give the same Error even if I change the /:\d+$/ => /:233\d/ I don't know how to fix it.
Do you need to use regex?
I don't know the purpose of this code but you could just use .replace() with a string instead of regex.
Like this:
let text = "https://stackoverflow.com";
console.log(text);
text = text.replace("stackoverflow", "www.stackoverflow");
console.log(text);